from classifier.maintaining_border import generate_parameters
from plot.plot_func import plot_stability_curves
from stochastic.average import run_multiple_simulations

# df版
param_list = {
    'gamma_LF': (1, 10),
    'gamma_LC': (1, 10),
    'gamma_HF': (0.3, 0.5),
    'gamma_HC': (1, 10),  # 质粒使得细菌可在高浓度存活，最低出生率大于最大死亡率
    # 'alpha_L': (1, 1),
    # 'alpha_H': (1, 1),
    # 'beta_L': (1, 1),
    # 'beta_H': (1, 1),
    'sigma': (0.5, 1),
    # 'omega_AL': (0, 0),
    # 'omega_AH': (0, 0.5),  # 高浓度导致死亡率增高
    'mu_L': (0.00001, 10),
    'mu_H': (0.00001, 10),
    'lambda_L': (0.00001, 10),
    'lambda_H': (0.00001, 10),
    'v_F': (0.00001, 10),
    'v_C': (0.00001, 10),
    'K': (10000, 50000),
    'LF0': (100, 1000),     'LC0': (100, 1000),
    'HF0': (0, 0),     'HC0': (0, 0)
}
fixed_params = {'gamma_LF': 1, 'gamma_LC': 1, 'gamma_HF': 0.3, 'gamma_HC': 0.3, 'sigma': 0.5,
                'lambda_L': 0.025, 'lambda_H': 0.025, 'v_F': 0.1, 'v_C': 0.1,
                'K': 100000, 'LF0': 500, 'LC0': 500, 'HF0': 0, 'HC0': 0}
params = generate_parameters(param_list, fixed_params, 10)
# 添加mu_H列，使其等于mu_L的值
params['mu_H'] = params['mu_L']
params.to_csv("params4.12.csv", index=False)
print("params已生成成功")

time = 160  # (默认150h)

df = run_multiple_simulations(params, time)
df.to_csv("avg4.12.csv", index=False)
print("csv存储成功")

plot_stability_curves(df)

